// 组件样式
@import './variables.scss';

// 数据卡片
.data-card {
  @include card-style;
  position: relative;
  overflow: hidden;
  
  .data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: $spacing-medium;
    
    .data-card-title {
      font-size: $font-size-medium;
      font-weight: $font-weight-primary;
      color: var(--el-text-color-primary);
      display: flex;
      align-items: center;
      
      .data-card-icon {
        margin-right: $spacing-small;
        font-size: $font-size-large;
      }
    }
    
    .data-card-extra {
      color: var(--el-text-color-secondary);
      font-size: $font-size-small;
    }
  }
  
  .data-card-content {
    .data-value {
      font-size: 2rem;
      font-weight: $font-weight-bold;
      line-height: 1;
      margin-bottom: $spacing-small;
      
      .data-unit {
        font-size: $font-size-medium;
        font-weight: $font-weight-secondary;
        color: var(--el-text-color-secondary);
        margin-left: 4px;
      }
    }
    
    .data-trend {
      display: flex;
      align-items: center;
      font-size: $font-size-small;
      
      .trend-icon {
        margin-right: 4px;
      }
      
      &.trend-up {
        color: $trend-up;
      }
      
      &.trend-down {
        color: $trend-down;
      }
      
      &.trend-stable {
        color: $trend-stable;
      }
    }
  }
  
  .data-card-footer {
    margin-top: $spacing-medium;
    padding-top: $spacing-medium;
    border-top: 1px solid var(--el-border-color-lighter);
    font-size: $font-size-small;
    color: var(--el-text-color-secondary);
  }
  
  // 温度卡片
  &.temperature-card {
    .data-value {
      color: $temperature-color;
    }
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 60px;
      height: 60px;
      background: $temperature-gradient;
      opacity: 0.1;
      border-radius: 0 $card-border-radius 0 60px;
    }
  }
  
  // 湿度卡片
  &.humidity-card {
    .data-value {
      color: $humidity-color;
    }
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 60px;
      height: 60px;
      background: $humidity-gradient;
      opacity: 0.1;
      border-radius: 0 $card-border-radius 0 60px;
    }
  }
  
  // 气压卡片
  &.pressure-card {
    .data-value {
      color: $pressure-color;
    }
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 60px;
      height: 60px;
      background: $pressure-gradient;
      opacity: 0.1;
      border-radius: 0 $card-border-radius 0 60px;
    }
  }
  
  // 光照卡片
  &.light-card {
    .data-value {
      color: $light-color;
    }
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 60px;
      height: 60px;
      background: $light-gradient;
      opacity: 0.1;
      border-radius: 0 $card-border-radius 0 60px;
    }
  }
}

// 统计卡片
.stat-card {
  @include card-style;
  text-align: center;
  
  .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto $spacing-medium;
    font-size: 24px;
    color: white;
    
    &.stat-primary {
      background: $primary-color;
    }
    
    &.stat-success {
      background: $success-color;
    }
    
    &.stat-warning {
      background: $warning-color;
    }
    
    &.stat-danger {
      background: $danger-color;
    }
  }
  
  .stat-value {
    font-size: 1.5rem;
    font-weight: $font-weight-bold;
    color: var(--el-text-color-primary);
    margin-bottom: $spacing-small;
  }
  
  .stat-label {
    font-size: $font-size-small;
    color: var(--el-text-color-secondary);
  }
}

// 图表容器
.chart-container {
  @include card-style;
  
  .chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: $spacing-medium;
    
    .chart-title {
      font-size: $font-size-medium;
      font-weight: $font-weight-primary;
      color: var(--el-text-color-primary);
    }
    
    .chart-actions {
      display: flex;
      align-items: center;
      gap: $spacing-small;
    }
  }
  
  .chart-content {
    position: relative;
    min-height: 300px;
    
    .chart-loading {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: rgba(255, 255, 255, 0.8);
      z-index: 10;
    }
    
    .chart-empty {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--el-text-color-secondary);
      
      .empty-icon {
        font-size: 48px;
        margin-bottom: $spacing-medium;
        opacity: 0.5;
      }
      
      .empty-text {
        font-size: $font-size-medium;
      }
    }
  }
}

// 仪表盘
.gauge-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  
  .gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    
    .gauge-number {
      font-size: 1.5rem;
      font-weight: $font-weight-bold;
      color: var(--el-text-color-primary);
      line-height: 1;
    }
    
    .gauge-unit {
      font-size: $font-size-small;
      color: var(--el-text-color-secondary);
      margin-top: 4px;
    }
  }
}

// 数据表格
.data-table {
  .table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: $spacing-medium;
    
    .table-title {
      font-size: $font-size-medium;
      font-weight: $font-weight-primary;
      color: var(--el-text-color-primary);
    }
    
    .table-actions {
      display: flex;
      align-items: center;
      gap: $spacing-small;
    }
  }
  
  .table-filters {
    margin-bottom: $spacing-medium;
    
    .filter-row {
      display: flex;
      align-items: center;
      gap: $spacing-medium;
      margin-bottom: $spacing-small;
      
      &:last-child {
        margin-bottom: 0;
      }
    }
    
    .filter-item {
      display: flex;
      align-items: center;
      gap: $spacing-small;
      
      .filter-label {
        font-size: $font-size-small;
        color: var(--el-text-color-secondary);
        white-space: nowrap;
      }
    }
  }
}

// 质量指示器
.quality-indicator {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: $border-radius;
  font-size: $font-size-small;
  font-weight: $font-weight-primary;
  
  .quality-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
  }
  
  &.quality-excellent {
    color: $quality-excellent;
    background-color: mix($quality-excellent, white, 10%);
    
    .quality-dot {
      background-color: $quality-excellent;
    }
  }
  
  &.quality-good {
    color: $quality-good;
    background-color: mix($quality-good, white, 10%);
    
    .quality-dot {
      background-color: $quality-good;
    }
  }
  
  &.quality-moderate {
    color: $quality-moderate;
    background-color: mix($quality-moderate, white, 10%);
    
    .quality-dot {
      background-color: $quality-moderate;
    }
  }
  
  &.quality-poor {
    color: $quality-poor;
    background-color: mix($quality-poor, white, 10%);
    
    .quality-dot {
      background-color: $quality-poor;
    }
  }
  
  &.quality-very-poor {
    color: $quality-very-poor;
    background-color: mix($quality-very-poor, white, 10%);
    
    .quality-dot {
      background-color: $quality-very-poor;
    }
  }
}

// 进度条
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--el-fill-color-lighter);
  border-radius: 4px;
  overflow: hidden;
  
  .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--el-color-primary), var(--el-color-primary-light-3));
    border-radius: 4px;
    transition: width 0.3s ease;
  }
  
  &.progress-success .progress-fill {
    background: linear-gradient(90deg, var(--el-color-success), var(--el-color-success-light-3));
  }
  
  &.progress-warning .progress-fill {
    background: linear-gradient(90deg, var(--el-color-warning), var(--el-color-warning-light-3));
  }
  
  &.progress-danger .progress-fill {
    background: linear-gradient(90deg, var(--el-color-danger), var(--el-color-danger-light-3));
  }
}

// 时间轴
.timeline {
  .timeline-item {
    position: relative;
    padding-left: 24px;
    padding-bottom: $spacing-medium;
    
    &::before {
      content: '';
      position: absolute;
      left: 6px;
      top: 6px;
      bottom: -#{$spacing-medium};
      width: 1px;
      background-color: var(--el-border-color-light);
    }
    
    &:last-child::before {
      display: none;
    }
    
    .timeline-dot {
      position: absolute;
      left: 0;
      top: 6px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background-color: var(--el-color-primary);
      border: 2px solid var(--el-bg-color);
      box-shadow: 0 0 0 1px var(--el-border-color-light);
    }
    
    .timeline-content {
      .timeline-time {
        font-size: $font-size-small;
        color: var(--el-text-color-secondary);
        margin-bottom: 4px;
      }
      
      .timeline-title {
        font-size: $font-size-base;
        font-weight: $font-weight-primary;
        color: var(--el-text-color-primary);
        margin-bottom: 4px;
      }
      
      .timeline-description {
        font-size: $font-size-small;
        color: var(--el-text-color-secondary);
        line-height: 1.4;
      }
    }
  }
}

// 响应式隐藏
@include respond-to(xs) {
  .hide-on-mobile {
    display: none !important;
  }
}

@include respond-to(md) {
  .hide-on-tablet {
    display: none !important;
  }
}

@include respond-to(lg) {
  .hide-on-desktop {
    display: none !important;
  }
}